package com.itheima.stock.job;

import com.itheima.stock.service.StockTimerTaskService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class StockJob {

    @Autowired
    private StockTimerTaskService stockTimerTaskService;

    @XxlJob("testJob")
    public void testJob(){
        log.info("执行日期：{}", DateTime.now().toString("yyyy-MM-dd HH:mm:ss"));
    }

    @XxlJob("collectMarketData")
    public void collectMarketData(){
        stockTimerTaskService.getInnerMarketInfo();
    }

    @XxlJob("collectStockData")
    public void collectStockData(){
        stockTimerTaskService.getStockRtIndex();
    }
}
